// pages/me/index/index.js
const https = require('../../../utils/https.js')
const user = require('../../../utils/user')
Page({

  /**
   * 页面的初始数据
   */
  data: {
    showKf: false,
    info: {}
  },
  back() {
    wx.navigateBack({
      delta: 1
    })
  },
  setShowKf() {
    this.setData({
      showKf: true
    })
  },
  getData() {
    if (!user.hasLogin()) return;
    https.post('/api/user/info', {}).then((res) => {
      if (res.code == 0) {
        this.setData({
          info: res.data
        })
      }
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getData()
  },
  refresh() {
    this.getData()
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  }
})